<!DOCTYPE html>
<html>
  <head>
    <title>配置寄件信息</title>
	<include file='public/head'>
	<style>
		.layui-legend-size{font-size:14px !important;}
		.layui-nopadding{padding:0 !important;}
		.layui-overflow{overflow:auto;}
		.layui-nomargin{margin: 0 !important;}
		.layui-bottom{border-bottom:1px solid rgb(226, 226, 226);}
		.layui-input{height:30px !important; }
		.layui-form-search-item .layui-inline{margin-bottom: 5px;} 
		.layui-form-search-item label{margin-left: 15px;}
		.layui-table-page {padding: 7px 0px 0px;}
		.layui-field-padding{border-width: 1px;padding:0 0 5px 10px;}
	</style>
</head>
<body>

<div class="layui-tab">
      <!-- 顶部导航菜单开始 -->
      <div class="layui-tab-nav">
        <ul class="layui-tab-title">
            {:getNav('logistics','logistics_order/logisticsConfig')};
        </ul>
      </div>
      <!-- 顶部导航菜单结束 -->
      <br>

<form class="layui-form" id="f" method="post"  >


  <label class="layui-form-label" style="font-size:20px">寄件信息</label>
  <input type="hidden" name="id" value="{$data.id?$data.id:''}">
  <table class="layui-table layui-nomargin" style="text-align: center;margin-top:20px">
    <tr>
      <td>面单方式</td>
      <td>
          <div class="layui-input-block">
            <input type="radio" name="mode" value="1" title="线上" <?php if(!empty($data['mode']) && $data['mode']==1 ){ echo 'checked';} ?> >
            <input type="radio" name="mode" value="2" title="线下" <?php if(!empty($data['mode']) && $data['mode']==2 ){ echo 'checked';} ?> >
          </div>
      </td>
    </tr>
    <tr>
      <td>默认物流公司</td>
      <td>
        <select type="text" name="code" autocomplete="off" placeholder="选择物流公司"  lay-verify="required" class="layui-select" lay-search>
          <volist name="logistics" id="vo">
          <option value="{$vo.code}"
            <?php if(!empty($data['code']) && $data['code']==$vo['code'] ){ echo 'selected="selected"';} ?> >{$vo.company}</option>
          </volist>
        </select>
        
      </td>
    </tr>
    <tr>
      <td>寄件人</td>
      <td>
        <input type="text" name="name"  class="layui-input" required="" value="{$data.name|default=''}">
      </td>
    </tr>
    <tr>
      <td>电话</td>
      <td>
        <input type="text" name="mobile"  class="layui-input" required="" value="{$data.mobile|default=''}">
      </td>
    </tr>
    <tr>
      <td>省|自治区|直辖市</td>
      <td>
        <input type="text" name="province_name"  class="layui-input" required="" value="{$data.province_name|default=''}">
      </td>
    </tr>
    <tr>
      <td>市|自治州|地区|区划|县</td>
      <td>
        <input type="text" name="city_name"  class="layui-input" required="" value="{$data.city_name|default=''}">
      </td>
    </tr>
    <tr>
      <td>区|县|镇|乡|街道</td>
      <td>
        <input type="text" name="exp_area_name"  class="layui-input" required="" value="{$data.exp_area_name|default=''}">
      </td>
    </tr>
    <tr>
      <td>详细地址</td>
      <td>
        <input type="text" name="address"  class="layui-input" required="" value="{$data.address|default=''}">
      </td>
    </tr>
    <tr>
      <td colspan="2" style="text-align:center;">
        <button type="button" class="layui-btn layui-btn-sm"  onclick="tijiao()">提交</button>
      </td>
    </tr>
  </table>


</form>
</div>
</body>

<include file="public/scripts"/>
<script>
  
  function tijiao(){
    
    
    var dara = $("#f").serialize();

    $.ajax({
      url:"{:cmf_plugin_url('logistics://logistics_order/logisticsConfig')}",
      data:dara,
      type:'post',
      success:function(data){
        if (data.code == 200) {
          layer.msg(data.message,{icon:1,time:1500},function(){
            window.location.reload(); 
          });
        } else {
          layer.msg(data.message,{icon:2,time:1500});
        }
      },
      error:function()
      {
        layer.msg('系统错误',{icon:2,time:1500});
      }
    })
    }
</script>
</html>